package Day11;

import java.util.*;
// 1:无需package
// 2: 类名必须Main, 不可修改
/**
 * 2021Java真题:特殊年份
 * https://www.lanqiao.cn/problems/2377/learning/
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int count = 0;
        for(int i = 0; i < 5; i++){
          char[] ch = scan.next().toCharArray();
          if(ch[0] == ch[2] && ch[1] + 1 == ch[3]){
            count++;
          }
        }
        System.out.println(count);
        scan.close();
    }
}